package promote.brozen.base.thread;

import java.util.concurrent.locks.LockSupport;

/**
 * @author Brozen
 * @date 2020/9/10 5:53 PM
 * @email brozen@qq.com
 */
public class ThreadWaiting {

    public static void main(String[] args) {

        Thread t1 = new Thread(LockSupport::park);

        Thread t2 = new Thread(() -> {
            try {
                t1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        System.out.println("T1 = " + t1.getState());
        System.out.println("T2 = " + t2.getState());

        t1.start();
        t2.start();

        System.out.println("T1 = " + t1.getState());
        System.out.println("T2 = " + t2.getState());

    }

}
